﻿package learnmath.windows.elements{
/*-------------------------------------------------------------
	Created by: Ionel Alexandru 
	Mail: ionel.alexandru@gmail.com
	Site: www.learn-math.info
---------------------------------------------------------------*/
import learnmath.windows.elements.*;
import flash.display.*;
import flash.events.*;
import flash.geom.*;

public class MainPannelXP extends Pannel{
	
	public var workingPannel:MovieClip;
	public var taskbar:TaskBar;
	public var iconsManager:IconsManager;
	public var windowsManager:WindowsManager;
	public var leftPannel:MovieClip;
	public var topPannel:MovieClip;
	public var bottomPannel:MovieClip;
	public var lastPannel:MovieClip;

	
	public function MainPannelXP(parent:MovieClip, x:int, y:int, _width:int, _height:int){
		super(parent, x, y, _width, _height);
		
		pannel.transform.perspectiveProjection = new PerspectiveProjection();
		pannel.transform.perspectiveProjection.projectionCenter = new Point(_width, _height/2);
		
		var centerRadius:int = 10;
			
		leftPannel = new MovieClip();
		leftPannel.rotationY = -90;
		
		leftPannel.graphics.lineStyle(1,0xaaaaaa);
		leftPannel.graphics.moveTo(0,0);
		leftPannel.graphics.lineTo(0, _height);
		leftPannel.graphics.lineTo(_height, _height);
		leftPannel.graphics.lineTo(_height, 0);
		leftPannel.graphics.lineTo(0, 0);
		pannel.addChild(leftPannel)

		lastPannel = new MovieClip();
		lastPannel.z = _height;
		
		lastPannel.graphics.lineStyle(1,0xaaaaaa);
		lastPannel.graphics.moveTo(0,0);
		lastPannel.graphics.lineTo(0, _height);
		lastPannel.graphics.lineTo(_width, _height);
		lastPannel.graphics.lineTo(_width, 0);
		lastPannel.graphics.lineTo(0, 0);
		pannel.addChild(lastPannel)
		
		topPannel = new MovieClip();
		topPannel.graphics.lineStyle(1,0x888888);
		for(var i=1; i<11; i++){
			//topPannel.graphics.moveTo(i*_width/10,0);
			//topPannel.graphics.lineTo(i*_width/10, _height);
		}
		topPannel.rotationX = 90;
		pannel.addChild(topPannel)

		bottomPannel = new MovieClip();
		bottomPannel.y = _height;
		bottomPannel.rotationX = 90;
		pannel.addChild(bottomPannel)

		var logo:MovieClip = new LogoMovieClip();
		lastPannel.addChild(logo);
		logo.x =width-750;
		logo.y =1;
		
		workingPannel = new MovieClip();
		pannel.addChild(workingPannel);
	}
	
	public function init():void{
		taskbar = new TaskBar(pannel, 0, height-30, width, 30);
		windowsManager = new WindowsManager(taskbar);
		iconsManager = new IconsManager(taskbar, windowsManager);
	}
	
	public function drawOnFrame():void{
		windowsManager.drawOnFrame();
	}
	
	public function processKey(e:KeyboardEvent) {
		windowsManager.processKey(e)
	}
	
}
}